<template>
  <div>
    <van-collapse
      v-model="activeName"
      accordion
      v-for="itme in data"
      :key="itme"
    >
      <van-collapse-item :title="itme.name" name="1">
        <ul v-for="i in itme.son" :key="i">
          <router-link :to="{ path: i.url, query: { id: i.id } }">{{
            i["name"]
          }}</router-link>
        </ul>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>

<script>
import axios from "axios";
// import router from "@/router";
export default {
  name: "yangone",
  data() {
    return {
      activeName: "1",
      uid: 1,
      data: "",
      data1: "",
    };
  },
  methods: {
    getdata() {
      axios({
        url: "/getresource",
        params: { id: this.uid },
        method: "get",
      }).then((res) => {
        this.data = res.data.list;
        console.log(res);
      });
    },
    getone(id) {
      axios({ url: "/treecom", params: id, method: "get" }).then((res) => {
        this.data1 = res.data.list;
      });
      // router.push({ name: "xiangqing", params: { id: id } });
    },
  },
  mounted() {
    this.getdata();
  },
};
</script>

<style scoped></style>
